<?php

namespace app\uniapp\controller;

use app\common\exception\MiException;
use app\Request;
use app\uniapp\service\SiteService;
use app\uniapp\service\UniAuthService;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;

class IndexController extends UniController
{

    /**
     * 首页信息
     * @throws MiException
     */
    public function index(): \think\response\Json
    {
        $page = UniAuthService::instance()->getIndex();
        return jsonSuccess([
            'page' => $page,
        ]);
    }

    /**
     * 商家信息
     * @throws DataNotFoundException
     * @throws ModelNotFoundException
     * @throws DbException
     * @throws MiException
     */
    public function site(): \think\response\Json
    {
        $site = UniAuthService::instance()->getSite();
        return jsonSuccess([
            'site' => $site,
        ]);
    }

}
